<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.2"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Hardware Abstraction Layer (HAL)</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><a href="http://www.cypress.com/"><img alt="Logo" src="logo.png"/></a></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Hardware Abstraction Layer (HAL)</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.2 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('group__group__hal__crc.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#groups">API Reference</a> &#124;
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle"><div class="title">CRC (Cyclic Redundancy Check)<div class="ingroups"><a class="el" href="group__group__hal.html">HAL Drivers</a></div></div></div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">General Description</h2>
<p >High level interface for interacting with the CRC, which provides hardware accelerated CRC computations. </p>
<p >The CRC APIs are structured to enable usage in situations where the entire input data set is not available in memory at the same time. Therefore, each conversion consists of three steps:</p><ul>
<li>A single call to <a class="el" href="group__group__hal__crc.html#gac4d388f57a325090b05d718d7f20e333">cyhal_crc_start</a>, to initialize data structures used to compute CRC</li>
<li>One or more calls to <a class="el" href="group__group__hal__crc.html#ga17e1a6544fecaa60880111d9ad2428f2">cyhal_crc_compute</a>, to provide chunks of data</li>
<li>A single call to <a class="el" href="group__group__hal__crc.html#ga2457c4fa6536551e89c21f9bd476c601">cyhal_crc_finish</a>, to finalize the computation and retrieve the result</li>
</ul>
<p >The table below provides CRC parameters for some common CRC algorithms. </p><dl class="section note"><dt>Note</dt><dd>The Expected CRC column shows the computed CRC when the value "123456789" is passed to <a class="el" href="group__group__hal__crc.html#ga17e1a6544fecaa60880111d9ad2428f2">cyhal_crc_compute</a>.</dd></dl>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone">CRC algorithm Name   </th><th class="markdownTableHeadNone">Len   </th><th class="markdownTableHeadNone">Polynomial   </th><th class="markdownTableHeadNone">Initial seed   </th><th class="markdownTableHeadNone">Data REV   </th><th class="markdownTableHeadNone">Data XOR   </th><th class="markdownTableHeadNone">Rem REV   </th><th class="markdownTableHeadNone">Remainder XOR   </th><th class="markdownTableHeadNone">Expected CRC    </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">CRC-6 / CDMA2000-A   </td><td class="markdownTableBodyNone">6   </td><td class="markdownTableBodyNone">0x27   </td><td class="markdownTableBodyNone">0x3F   </td><td class="markdownTableBodyNone">false   </td><td class="markdownTableBodyNone">0   </td><td class="markdownTableBodyNone">false   </td><td class="markdownTableBodyNone">0x00   </td><td class="markdownTableBodyNone">0x0D    </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">CRC-6 / CDMA2000-B   </td><td class="markdownTableBodyNone">6   </td><td class="markdownTableBodyNone">0x07   </td><td class="markdownTableBodyNone">0x3F   </td><td class="markdownTableBodyNone">false   </td><td class="markdownTableBodyNone">0   </td><td class="markdownTableBodyNone">false   </td><td class="markdownTableBodyNone">0x00   </td><td class="markdownTableBodyNone">0x3B    </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">CRC-6 / DARC   </td><td class="markdownTableBodyNone">6   </td><td class="markdownTableBodyNone">0x19   </td><td class="markdownTableBodyNone">0x00   </td><td class="markdownTableBodyNone">true   </td><td class="markdownTableBodyNone">0   </td><td class="markdownTableBodyNone">true   </td><td class="markdownTableBodyNone">0x00   </td><td class="markdownTableBodyNone">0x26    </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">CRC-6 / ITU   </td><td class="markdownTableBodyNone">6   </td><td class="markdownTableBodyNone">0x03   </td><td class="markdownTableBodyNone">0x00   </td><td class="markdownTableBodyNone">true   </td><td class="markdownTableBodyNone">0   </td><td class="markdownTableBodyNone">true   </td><td class="markdownTableBodyNone">0x00   </td><td class="markdownTableBodyNone">0x06    </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">CRC-8 / ITU   </td><td class="markdownTableBodyNone">8   </td><td class="markdownTableBodyNone">0x07   </td><td class="markdownTableBodyNone">0x00   </td><td class="markdownTableBodyNone">false   </td><td class="markdownTableBodyNone">0   </td><td class="markdownTableBodyNone">false   </td><td class="markdownTableBodyNone">0x55   </td><td class="markdownTableBodyNone">0xA1    </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">CRC-8 / MAXIM   </td><td class="markdownTableBodyNone">8   </td><td class="markdownTableBodyNone">0x31   </td><td class="markdownTableBodyNone">0x00   </td><td class="markdownTableBodyNone">true   </td><td class="markdownTableBodyNone">0   </td><td class="markdownTableBodyNone">true   </td><td class="markdownTableBodyNone">0x00   </td><td class="markdownTableBodyNone">0xA1    </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">CRC-8 / ROHC   </td><td class="markdownTableBodyNone">8   </td><td class="markdownTableBodyNone">0x07   </td><td class="markdownTableBodyNone">0xFF   </td><td class="markdownTableBodyNone">true   </td><td class="markdownTableBodyNone">0   </td><td class="markdownTableBodyNone">true   </td><td class="markdownTableBodyNone">0x00   </td><td class="markdownTableBodyNone">0xD0    </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">CRC-8 / WCDMA   </td><td class="markdownTableBodyNone">8   </td><td class="markdownTableBodyNone">0x9B   </td><td class="markdownTableBodyNone">0x00   </td><td class="markdownTableBodyNone">true   </td><td class="markdownTableBodyNone">0   </td><td class="markdownTableBodyNone">true   </td><td class="markdownTableBodyNone">0x00   </td><td class="markdownTableBodyNone">0x25    </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">CRC-16 / CCITT-0   </td><td class="markdownTableBodyNone">16   </td><td class="markdownTableBodyNone">0x1021   </td><td class="markdownTableBodyNone">0xFFFF   </td><td class="markdownTableBodyNone">false   </td><td class="markdownTableBodyNone">0   </td><td class="markdownTableBodyNone">false   </td><td class="markdownTableBodyNone">0x0000   </td><td class="markdownTableBodyNone">0x29B1    </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">CRC-16 / CDMA2000   </td><td class="markdownTableBodyNone">16   </td><td class="markdownTableBodyNone">0xC867   </td><td class="markdownTableBodyNone">0xFFFF   </td><td class="markdownTableBodyNone">false   </td><td class="markdownTableBodyNone">0   </td><td class="markdownTableBodyNone">false   </td><td class="markdownTableBodyNone">0x0000   </td><td class="markdownTableBodyNone">0x4C06    </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">CRC-32   </td><td class="markdownTableBodyNone">32   </td><td class="markdownTableBodyNone">0x04C11DB7   </td><td class="markdownTableBodyNone">0xFFFFFFFF   </td><td class="markdownTableBodyNone">true   </td><td class="markdownTableBodyNone">0   </td><td class="markdownTableBodyNone">true   </td><td class="markdownTableBodyNone">0xFFFFFFFF   </td><td class="markdownTableBodyNone">0xCBF43926    </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">CRC-32 / BZIP2   </td><td class="markdownTableBodyNone">32   </td><td class="markdownTableBodyNone">0x04C11DB7   </td><td class="markdownTableBodyNone">0xFFFFFFFF   </td><td class="markdownTableBodyNone">false   </td><td class="markdownTableBodyNone">0   </td><td class="markdownTableBodyNone">false   </td><td class="markdownTableBodyNone">0xFFFFFFFF   </td><td class="markdownTableBodyNone">0xFC891918   </td></tr>
</table>
<dl class="section note"><dt>Note</dt><dd>Algorithms that have less than 8 bits, like CRC-6, populate the lower bits and leave the high order bits 0.</dd>
<dd>
Many of the algorithm parameters can be customized.</dd></dl>
<p>See <a class="el" href="group__group__hal__crc.html#structcrc__algorithm__t">crc_algorithm_t</a> and <a class="el" href="group__group__hal__crc.html#subsection_crc_snippet_1">Snippet1: CRC Generation</a> for more details.</p>
<h1><a class="anchor" id="subsection_crc_quickstart"></a>
Quick Start</h1>
<p ><a class="el" href="group__group__hal__crc.html#gaf7d80ad97b75d1284db96b94274a837a">cyhal_crc_init</a> initializes the CRC generator and passes the pointer to the CRC block through the <b>obj</b> object of type <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__crc__t">cyhal_crc_t</a>.</p>
<h2><a class="anchor" id="subsection_crc_snippet_1"></a>
Snippet1: CRC Generation</h2>
<p >The following snippet initializes a CRC generator and computes the CRC for a sample message.</p>
<div class="fragment"><div class="line"> </div>
<div class="line">    <span class="comment">// Using CRC-16/CCITT-0 Algorithm</span></div>
<div class="line"><span class="preprocessor">    #define CRC_BITLEN          (16u)</span></div>
<div class="line"><span class="preprocessor">    #define CRC_POLYNOMIAL      (0x1021u)</span></div>
<div class="line"><span class="preprocessor">    #define CRC_LFSR_SEED       (0xffffu)</span></div>
<div class="line"><span class="preprocessor">    #define CRC_DATA_REVERSE    (0u)</span></div>
<div class="line"><span class="preprocessor">    #define CRC_DATA_XOR        (0u)</span></div>
<div class="line"><span class="preprocessor">    #define CRC_REM_REVERSE     (0u)</span></div>
<div class="line"><span class="preprocessor">    #define CRC_REM_XOR         (0x0000u)</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">    #define MSG_LENGTH 9</span></div>
<div class="line"> </div>
<div class="line">    CY_ALIGN(4) uint8_t message[MSG_LENGTH] = &quot;123456789&quot;;</div>
<div class="line">    CY_ALIGN(4) uint32_t calc_crc           = 0;</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Set CRC algorithm parameters</span></div>
<div class="line">    <a class="code hl_struct" href="group__group__hal__crc.html#structcrc__algorithm__t">crc_algorithm_t</a> my_algorithm =</div>
<div class="line">    {</div>
<div class="line">        .<a class="code hl_variable" href="group__group__hal__crc.html#a43f6798e59b2c14c20cf662a9c8952e6">width</a>         = CRC_BITLEN,</div>
<div class="line">        .polynomial    = CRC_POLYNOMIAL,</div>
<div class="line">        .lfsrInitState = CRC_LFSR_SEED,</div>
<div class="line">        .dataReverse   = CRC_DATA_REVERSE,</div>
<div class="line">        .dataXor       = CRC_DATA_XOR,</div>
<div class="line">        .remReverse    = CRC_REM_REVERSE,</div>
<div class="line">        .remXor        = CRC_REM_XOR</div>
<div class="line">    };</div>
<div class="line"> </div>
<div class="line">    <a class="code hl_typedef" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>   rslt;</div>
<div class="line">    <a class="code hl_struct" href="group__group__hal__impl__hw__types.html#structcyhal__crc__t">cyhal_crc_t</a> crc_obj;</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Initialize the CRC Generator</span></div>
<div class="line">    rslt = <a class="code hl_function" href="group__group__hal__crc.html#gaf7d80ad97b75d1284db96b94274a837a">cyhal_crc_init</a>(&amp;crc_obj);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Initialize the CRC algorithm parameters</span></div>
<div class="line">    rslt = <a class="code hl_function" href="group__group__hal__crc.html#gac4d388f57a325090b05d718d7f20e333">cyhal_crc_start</a>(&amp;crc_obj, &amp;my_algorithm);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Compute CRC</span></div>
<div class="line">    rslt = <a class="code hl_function" href="group__group__hal__crc.html#ga17e1a6544fecaa60880111d9ad2428f2">cyhal_crc_compute</a>(&amp;crc_obj, message, MSG_LENGTH);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Finish computation</span></div>
<div class="line">    rslt = <a class="code hl_function" href="group__group__hal__crc.html#ga2457c4fa6536551e89c21f9bd476c601">cyhal_crc_finish</a>(&amp;crc_obj, &amp;calc_crc);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Additional computations can be done here if needed</span></div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Release the CRC generator</span></div>
<div class="line">    <span class="comment">// Note: Free only if not required anymore</span></div>
<div class="line">    <a class="code hl_function" href="group__group__hal__crc.html#ga13e98c8757355f979fbe955d94763336">cyhal_crc_free</a>(&amp;crc_obj);</div>
<div class="line"> </div>
<div class="ttc" id="agroup__group__hal__crc_html_a43f6798e59b2c14c20cf662a9c8952e6"><div class="ttname"><a href="group__group__hal__crc.html#a43f6798e59b2c14c20cf662a9c8952e6">crc_algorithm_t::width</a></div><div class="ttdeci">uint32_t width</div><div class="ttdoc">Bit width of the CRC.</div><div class="ttdef"><b>Definition:</b> cyhal_crc.h:104</div></div>
<div class="ttc" id="agroup__group__hal__crc_html_ga13e98c8757355f979fbe955d94763336"><div class="ttname"><a href="group__group__hal__crc.html#ga13e98c8757355f979fbe955d94763336">cyhal_crc_free</a></div><div class="ttdeci">void cyhal_crc_free(cyhal_crc_t *obj)</div><div class="ttdoc">Release the CRC generator.</div></div>
<div class="ttc" id="agroup__group__hal__crc_html_ga17e1a6544fecaa60880111d9ad2428f2"><div class="ttname"><a href="group__group__hal__crc.html#ga17e1a6544fecaa60880111d9ad2428f2">cyhal_crc_compute</a></div><div class="ttdeci">cy_rslt_t cyhal_crc_compute(const cyhal_crc_t *obj, const uint8_t *data, size_t length)</div><div class="ttdoc">Computes the CRC for the given data and accumulates the CRC with the CRC generated from previous call...</div></div>
<div class="ttc" id="agroup__group__hal__crc_html_ga2457c4fa6536551e89c21f9bd476c601"><div class="ttname"><a href="group__group__hal__crc.html#ga2457c4fa6536551e89c21f9bd476c601">cyhal_crc_finish</a></div><div class="ttdeci">cy_rslt_t cyhal_crc_finish(const cyhal_crc_t *obj, uint32_t *crc)</div><div class="ttdoc">Finalizes the CRC computation and returns the CRC for the complete set of data passed through a singl...</div></div>
<div class="ttc" id="agroup__group__hal__crc_html_gac4d388f57a325090b05d718d7f20e333"><div class="ttname"><a href="group__group__hal__crc.html#gac4d388f57a325090b05d718d7f20e333">cyhal_crc_start</a></div><div class="ttdeci">cy_rslt_t cyhal_crc_start(cyhal_crc_t *obj, const crc_algorithm_t *algorithm)</div><div class="ttdoc">The CRC block is setup to perform CRC computation.</div></div>
<div class="ttc" id="agroup__group__hal__crc_html_gaf7d80ad97b75d1284db96b94274a837a"><div class="ttname"><a href="group__group__hal__crc.html#gaf7d80ad97b75d1284db96b94274a837a">cyhal_crc_init</a></div><div class="ttdeci">cy_rslt_t cyhal_crc_init(cyhal_crc_t *obj)</div><div class="ttdoc">Initialize the CRC generator.</div></div>
<div class="ttc" id="agroup__group__hal__crc_html_structcrc__algorithm__t"><div class="ttname"><a href="group__group__hal__crc.html#structcrc__algorithm__t">crc_algorithm_t</a></div><div class="ttdoc">CRC algorithm parameters.</div><div class="ttdef"><b>Definition:</b> cyhal_crc.h:103</div></div>
<div class="ttc" id="agroup__group__hal__impl__hw__types_html_structcyhal__crc__t"><div class="ttname"><a href="group__group__hal__impl__hw__types.html#structcyhal__crc__t">cyhal_crc_t</a></div><div class="ttdoc">CRC object.</div><div class="ttdef"><b>Definition:</b> cyhal_hw_types.h:624</div></div>
<div class="ttc" id="agroup__group__result_html_gaca79700fcc701534ce61778a9bcf57d1"><div class="ttname"><a href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a></div><div class="ttdeci">uint32_t cy_rslt_t</div><div class="ttdoc">Provides the result of an operation as a structured bitfield.</div><div class="ttdef"><b>Definition:</b> cy_result.h:438</div></div>
</div><!-- fragment --> <table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="groups" name="groups"></a>
API Reference</h2></td></tr>
<tr class="memitem:group__group__hal__results__crc"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__results__crc.html">CRC HAL Results</a></td></tr>
<tr class="memdesc:group__group__hal__results__crc"><td class="mdescLeft">&#160;</td><td class="mdescRight">CRC specific return codes. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="nested-classes" name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:structcrc__algorithm__t"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__crc.html#structcrc__algorithm__t">crc_algorithm_t</a></td></tr>
<tr class="memdesc:structcrc__algorithm__t"><td class="mdescLeft">&#160;</td><td class="mdescRight">CRC algorithm parameters.  <a href="group__group__hal__crc.html#structcrc__algorithm__t">More...</a><br /></td></tr>
<tr class="separator:structcrc__algorithm__t"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:gaf7d80ad97b75d1284db96b94274a837a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__crc.html#gaf7d80ad97b75d1284db96b94274a837a">cyhal_crc_init</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__crc__t">cyhal_crc_t</a> *obj)</td></tr>
<tr class="memdesc:gaf7d80ad97b75d1284db96b94274a837a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize the CRC generator.  <a href="group__group__hal__crc.html#gaf7d80ad97b75d1284db96b94274a837a">More...</a><br /></td></tr>
<tr class="separator:gaf7d80ad97b75d1284db96b94274a837a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga13e98c8757355f979fbe955d94763336"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__crc.html#ga13e98c8757355f979fbe955d94763336">cyhal_crc_free</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__crc__t">cyhal_crc_t</a> *obj)</td></tr>
<tr class="memdesc:ga13e98c8757355f979fbe955d94763336"><td class="mdescLeft">&#160;</td><td class="mdescRight">Release the CRC generator.  <a href="group__group__hal__crc.html#ga13e98c8757355f979fbe955d94763336">More...</a><br /></td></tr>
<tr class="separator:ga13e98c8757355f979fbe955d94763336"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gac4d388f57a325090b05d718d7f20e333"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__crc.html#gac4d388f57a325090b05d718d7f20e333">cyhal_crc_start</a> (<a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__crc__t">cyhal_crc_t</a> *obj, const <a class="el" href="group__group__hal__crc.html#structcrc__algorithm__t">crc_algorithm_t</a> *algorithm)</td></tr>
<tr class="memdesc:gac4d388f57a325090b05d718d7f20e333"><td class="mdescLeft">&#160;</td><td class="mdescRight">The CRC block is setup to perform CRC computation.  <a href="group__group__hal__crc.html#gac4d388f57a325090b05d718d7f20e333">More...</a><br /></td></tr>
<tr class="separator:gac4d388f57a325090b05d718d7f20e333"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga17e1a6544fecaa60880111d9ad2428f2"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__crc.html#ga17e1a6544fecaa60880111d9ad2428f2">cyhal_crc_compute</a> (const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__crc__t">cyhal_crc_t</a> *obj, const uint8_t *data, size_t length)</td></tr>
<tr class="memdesc:ga17e1a6544fecaa60880111d9ad2428f2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Computes the CRC for the given data and accumulates the CRC with the CRC generated from previous calls.  <a href="group__group__hal__crc.html#ga17e1a6544fecaa60880111d9ad2428f2">More...</a><br /></td></tr>
<tr class="separator:ga17e1a6544fecaa60880111d9ad2428f2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga2457c4fa6536551e89c21f9bd476c601"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__hal__crc.html#ga2457c4fa6536551e89c21f9bd476c601">cyhal_crc_finish</a> (const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__crc__t">cyhal_crc_t</a> *obj, uint32_t *crc)</td></tr>
<tr class="memdesc:ga2457c4fa6536551e89c21f9bd476c601"><td class="mdescLeft">&#160;</td><td class="mdescRight">Finalizes the CRC computation and returns the CRC for the complete set of data passed through a single call or multiple calls to <a class="el" href="group__group__hal__crc.html#ga17e1a6544fecaa60880111d9ad2428f2">cyhal_crc_compute</a>.  <a href="group__group__hal__crc.html#ga2457c4fa6536551e89c21f9bd476c601">More...</a><br /></td></tr>
<tr class="separator:ga2457c4fa6536551e89c21f9bd476c601"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<hr/><h2 class="groupheader">Data Structure Documentation</h2>
<a name="structcrc__algorithm__t" id="structcrc__algorithm__t"></a>
<h2 class="memtitle"><span class="permalink"><a href="#structcrc__algorithm__t">&#9670;&nbsp;</a></span>crc_algorithm_t</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">struct crc_algorithm_t</td>
        </tr>
      </table>
</div><div class="memdoc">
<table class="fieldtable">
<tr><th colspan="3">Data Fields</th></tr>
<tr><td class="fieldtype">
<a id="a43f6798e59b2c14c20cf662a9c8952e6" name="a43f6798e59b2c14c20cf662a9c8952e6"></a>uint32_t</td>
<td class="fieldname">
width</td>
<td class="fielddoc">
Bit width of the CRC. </td></tr>
<tr><td class="fieldtype">
<a id="a75ef8f2fc1413a0d9fc0e6e54446e381" name="a75ef8f2fc1413a0d9fc0e6e54446e381"></a>uint32_t</td>
<td class="fieldname">
polynomial</td>
<td class="fielddoc">
The polynomial to use. </td></tr>
<tr><td class="fieldtype">
<a id="a764e5ee5b27363ed28ac4cca415a089e" name="a764e5ee5b27363ed28ac4cca415a089e"></a>uint32_t</td>
<td class="fieldname">
lfsrInitState</td>
<td class="fielddoc">
Initial state of the LFSR. </td></tr>
<tr><td class="fieldtype">
<a id="aba877155c7581d729886913d945e9373" name="aba877155c7581d729886913d945e9373"></a>uint32_t</td>
<td class="fieldname">
dataXor</td>
<td class="fielddoc">
Byte mask to xor with the data. </td></tr>
<tr><td class="fieldtype">
<a id="a47e14b82b511b028131dc7bef2cc2a47" name="a47e14b82b511b028131dc7bef2cc2a47"></a>uint32_t</td>
<td class="fieldname">
remXor</td>
<td class="fielddoc">
Mask to xor with the remainder. </td></tr>
<tr><td class="fieldtype">
<a id="a500da567a545d16ec7f1e7de51b97b6f" name="a500da567a545d16ec7f1e7de51b97b6f"></a>bool</td>
<td class="fieldname">
dataReverse</td>
<td class="fielddoc">
The order in which data should be processed. <p >If 0, data is processed MSB first. If 1, data is processed LSB first. </p>
</td></tr>
<tr><td class="fieldtype">
<a id="a5ad81955519341e5b258a54559a4146f" name="a5ad81955519341e5b258a54559a4146f"></a>bool</td>
<td class="fieldname">
remReverse</td>
<td class="fielddoc">
If 1, the remainder is reversed. If 0, it is not. </td></tr>
</table>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="gaf7d80ad97b75d1284db96b94274a837a" name="gaf7d80ad97b75d1284db96b94274a837a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaf7d80ad97b75d1284db96b94274a837a">&#9670;&nbsp;</a></span>cyhal_crc_init()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_crc_init </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__crc__t">cyhal_crc_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Initialize the CRC generator. </p>
<p >This function reserves the CRYPTO block for CRC calculations.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[out]</td><td class="paramname">obj</td><td>Pointer to a CRC generator object. The caller must allocate the memory for this object but the init function will initialize its contents. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the init request.</dd></dl>
<p>Returns <a class="el" href="group__group__result.html#gaf58fac450d9fff4472f03ad68f6e546e">CY_RSLT_SUCCESS</a> if the operation was successful. Refer <a class="el" href="group__group__hal__crc.html#subsection_crc_snippet_1">Snippet1: CRC Generation</a> for more information. </p>

</div>
</div>
<a id="ga13e98c8757355f979fbe955d94763336" name="ga13e98c8757355f979fbe955d94763336"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga13e98c8757355f979fbe955d94763336">&#9670;&nbsp;</a></span>cyhal_crc_free()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void cyhal_crc_free </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__crc__t">cyhal_crc_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Release the CRC generator. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">obj</td><td>The CRC generator object </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="gac4d388f57a325090b05d718d7f20e333" name="gac4d388f57a325090b05d718d7f20e333"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gac4d388f57a325090b05d718d7f20e333">&#9670;&nbsp;</a></span>cyhal_crc_start()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_crc_start </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__crc__t">cyhal_crc_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="group__group__hal__crc.html#structcrc__algorithm__t">crc_algorithm_t</a> *&#160;</td>
          <td class="paramname"><em>algorithm</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>The CRC block is setup to perform CRC computation. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">obj</td><td>The CRC generator object </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">algorithm</td><td>The CRC algorithm to use for computations Refer <a class="el" href="group__group__hal__crc.html#structcrc__algorithm__t">crc_algorithm_t</a>. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the compute request</dd></dl>
<dl class="section note"><dt>Note</dt><dd>The state of the CRC Block will be reset to the state provided by in the argument algorithm.</dd></dl>
<p>Returns <a class="el" href="group__group__result.html#gaf58fac450d9fff4472f03ad68f6e546e">CY_RSLT_SUCCESS</a> if the operation was successful. </p>

</div>
</div>
<a id="ga17e1a6544fecaa60880111d9ad2428f2" name="ga17e1a6544fecaa60880111d9ad2428f2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga17e1a6544fecaa60880111d9ad2428f2">&#9670;&nbsp;</a></span>cyhal_crc_compute()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_crc_compute </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__crc__t">cyhal_crc_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>length</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Computes the CRC for the given data and accumulates the CRC with the CRC generated from previous calls. </p>
<p >This function can be called multiple times to provide additional data. </p><dl class="section note"><dt>Note</dt><dd>Input data must be 4-byte aligned. Refer <a class="el" href="group__group__hal__crc.html#subsection_crc_snippet_1">Snippet1: CRC Generation</a> for more details. </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">obj</td><td>The CRC generator object </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">data</td><td>The input data </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">length</td><td>The number of bytes in the data </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the compute request</dd></dl>
<p>Returns <a class="el" href="group__group__result.html#gaf58fac450d9fff4472f03ad68f6e546e">CY_RSLT_SUCCESS</a> if the operation was successful. </p>

</div>
</div>
<a id="ga2457c4fa6536551e89c21f9bd476c601" name="ga2457c4fa6536551e89c21f9bd476c601"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga2457c4fa6536551e89c21f9bd476c601">&#9670;&nbsp;</a></span>cyhal_crc_finish()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__result.html#gaca79700fcc701534ce61778a9bcf57d1">cy_rslt_t</a> cyhal_crc_finish </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="group__group__hal__impl__hw__types.html#structcyhal__crc__t">cyhal_crc_t</a> *&#160;</td>
          <td class="paramname"><em>obj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t *&#160;</td>
          <td class="paramname"><em>crc</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Finalizes the CRC computation and returns the CRC for the complete set of data passed through a single call or multiple calls to <a class="el" href="group__group__hal__crc.html#ga17e1a6544fecaa60880111d9ad2428f2">cyhal_crc_compute</a>. </p>
<dl class="section note"><dt>Note</dt><dd>The computed CRC pointer provided must be 4 byte aligned. Refer to <a class="el" href="group__group__hal__crc.html#subsection_crc_snippet_1">Snippet1: CRC Generation</a> for more details.</dd>
<dd>
If the length of the CRC is less than a full word, the result will be in the lower bits allowing the result to be downcast if desired.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">obj</td><td>The CRC generator object </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">crc</td><td>The computed CRC </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the compute request</dd></dl>
<p>Returns <a class="el" href="group__group__result.html#gaf58fac450d9fff4472f03ad68f6e546e">CY_RSLT_SUCCESS</a> if the operation was successful. </p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part
<div id="nav-path" class="navpath">
    <ul>
        <li class="footer">
            Generated for <b>Hardware Abstraction Layer (HAL)</b> by <b>Cypress Semiconductor Corporation</b>.
            All rights reserved.
        </li>
    </ul>
</div>
-->
</body>
</html>
